package com.shop2cn.app.liveseller.service;

import java.util.List;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.liveseller.parameter.LiveActivityProductDtoV2;
import com.ymatou.iapi.prodstock.parameter.LiveActivityDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*获取直播秒杀商品列表Call
*FreeMaker Template自动生成代码
*/
public class GetLiveActivityProductsCall extends YmatouBaseCall{
	private static String opurl ="api/live/GetLiveActivityProducts";
	
	public GetLiveActivityProductsCall() {
		super(EnvSetup.getSystemUrl("liveseller_app"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	public List<LiveActivityProductDtoV2> getLiveActivityProducts(){
		String sLiveActivityProducts=getJsonObject().get("Data").getAsJsonObject().get("LiveActivityProducts").getAsJsonArray().toString();
		List<LiveActivityProductDtoV2> LiveActivityProductList=(List<LiveActivityProductDtoV2>)FormatUtil.GSONToObject(sLiveActivityProducts, new TypeToken<List<LiveActivityProductDtoV2>>(){}.getType());
		return LiveActivityProductList;
	}
}